home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / BARNET / COMPILER / SATHER / !Sather / Library / Containrs / sa / stack < prev    next >
Text File  |  1996-07-16  |  1KB  |  49 lines

  1. ---------------------------> Sather 1.1 source file <--------------------------
  2. -- Author: Benedict A. Gomes <gomes@icsi.berkeley.edu>
  3. -- Copyright (C) 1995, International Computer Science Institute
  4. -- $Id: stack.sa,v 1.5 1996/07/16 04:38:17 holger Exp $
  5. --
  6. -- COPYRIGHT NOTICE: This code is provided WITHOUT ANY WARRANTY
  7. -- and is subject to the terms of the SATHER LIBRARY GENERAL PUBLIC
  8. -- LICENSE contained in the file: Sather/Doc/License of the
  9. -- Sather distribution. The license is also available from ICSI,
  10. -- 1947 Center St., Suite 600, Berkeley CA 94704, USA.
  11. -------------------------------------------------------------------
  12.  
  13. abstract class $STACK{T} < $NR_STACK{T}, $REENTRANT is --NR:
  14.    --NR: abstract class  $NR_STACK{T} < $DISPENSER{T} is
  15.    -- An abstract stack
  16.    
  17.    -- size: INT;
  18.    -- current: T;
  19.    -- remove: T;
  20.    -- elt!: T;
  21.    -- str: STR;
  22.    -- copy: SAME
  23.    -- has(e: T): BOOL;
  24.  
  25.    push(elt: T);
  26.    -- Push elt to the top of the stack
  27.    
  28.    pop: T;
  29.    -- Return and remove the topmost element
  30.    
  31.    top: T;
  32.    -- Return the topmost element
  33.    
  34.    size: INT;
  35.    -- Number of elements in the stack
  36.    
  37.    is_empty: BOOL;
  38.    -- True if size = 0
  39.  
  40.    elt!: T;
  41.    -- Return the elements in the order in which successive "pop"s
  42.    -- would yield them without actually removing the elements
  43.    
  44.    copy: SAME; --NR: copy: SAME;
  45.    -- Return a copy of the stack
  46.    
  47. end; -- abstract class $NR_STACK{T}
  48. -------------------------------------------------------------------
  49.